import 'dart:ui';

import 'package:flutter/material.dart';



class ColorUtil {


  static Color string2Color(String colorString) {
    try {
      int? value = 0x00000000;
      if (colorString.isNotEmpty) {
        if (colorString[0] == "#") {
          colorString = colorString.substring(1);
        }
        value = int.tryParse(colorString, radix: 16);
        if (value != null && value < 0xff000000) {
          value += 0xff000000;
        }
      }
      return Color(value!);
    } catch (e) {
      return Colors.red;
    }
  }
}
